<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include_once("../libs/setup.php");
include_once("../libs/helper.php");
session_start();

if (!check_user_session()) {
    header("Location: ../signin.php");
    return;
}

//include the dom pdf
require('../libs/dompdf/dompdf_config.inc.php');

//fetch the HTML output from smarty template
require 'review.php';
$mysqli = connect_database($smarty);
$userId = $_SESSION['ma_user'];
load_personal_information($userId, $mysqli, $smarty);
load_educations($userId, $mysqli, $smarty);
load_employs($userId, $mysqli, $smarty);
load_research_activity($userId, $mysqli, $smarty);
load_research_projects($userId, $mysqli, $smarty);
load_research_results($userId, $mysqli, $smarty);
load_more_infos($userId, $mysqli, $smarty);
load_social_activities($userId, $mysqli, $smarty);
$tpl;
if(isset($_GET['reviewlang']))
{
    $tpl = "profile/profile_".$_GET['reviewlang'].".tpl";
}
else
    $tpl = "profile/profile_vi.tpl";
$htmlcontent=$smarty->fetch($tpl);
//echo $htmlcontent;
//call dom pdf class
$dompdf = new DOMPDF();

$dompdf->load_html($htmlcontent);

$dompdf->render();
//display output in browser
$dompdf->stream("dompdf_out.pdf", array("Attachment" => false));


